/**
 * Created by ritamashin on 2017/11/7.
 */

export function resetError () {
    return {
        type: 'RESET_ERROR'
    }
}

export function resetErrorInput (screenId) {
    return {
        type: 'RESET_ERROR_INPUT',
        screenId
    }
}

export function errorInput (screenId, error) {
    return {
        type: 'ERROR_INPUT',
        screenId,
        error
    }
}

export function errorFlash (error, duration = 3000) {
    return dispatch => {
        dispatch({
            type: 'ERROR_FLASH',
            error
        })
        setTimeout(() => {
            dispatch({
                type: 'ERROR_FLASH',
                error: ''
            })
        }, duration)
    }
}